#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

#define int long long

void solve()
{
    int n;
    cin >> n;
    int sq = ceil(sqrt(n));
    if(sq * sq == n) cout << 0 << ' ' << sq << endl;
    else cout << -1 << endl;
}
signed main()
{
    int t; cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}